package org.iabako.shared.iservice.business;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.iabako.shared.entity.business.*;
import org.iabako.shared.entity.user.Enterprise;
import org.iabako.shared.iservice.generic.BusinessEntityServiceAsync;
import org.iabako.shared.iservice.generic.CRUDServiceAsync;
import org.iabako.shared.iservice.generic.SearchServiceAsync;
import org.iabako.shared.iservice.generic.SuggestServiceAsync;

import java.util.List;

/**
 * TODO javadoc
 * Date: 24/11/13
 * Time: 18:22
 */
public interface ClientServiceAsync extends SearchServiceAsync, SuggestServiceAsync, CRUDServiceAsync, BusinessEntityServiceAsync {

    void getPayments(Client client, AsyncCallback<List<Payment>> async);

    void getInstallments(Client client, AsyncCallback<List<Installment>> async);

    void calculateStatus(Client client, AsyncCallback<Client> async);

    void getCustomFieldsValue(Client client, AsyncCallback<List<CustomFieldValue>> async);

    void save(Client client, List<CustomFieldValue> customFieldValues, AsyncCallback<Client> async);

    void getClientByEmail(Enterprise enterprise, String email, AsyncCallback<Client> async);

    void save(Client client, AsyncCallback<Client> async);

    void hasInstallments(Client client, AsyncCallback<Boolean> async);

    public static final class Util {
        private static ClientServiceAsync instance;

        public static final ClientServiceAsync getInstance() {
            if (instance == null) {
                instance = GWT.create(ClientService.class);
            }
            return instance;
        }
    }
}
